log2
Type
function
Summary
Returns the base-2 logarithm of a number.
Syntax
the log2 of <number>
log2(<number>)
Description
Use the log2 function to obtain a base-2 logarithm.
The base-2 logarithm of a number is the power to which 2 must be raised to obtain the number : 2^log2(number) is equal to number.
If a math operation on finite inputs produces a non-finite output, an execution error is thrown. See math operations for more information.
Parameters
Name | Type | Description |
---|---|---|
number | A positive number, or an expression that evaluates to a positive number. |
Examples
log2(8) -- returns 3
log2(0.125) -- returns -3
Related
control structure: function
function: ln1
glossary: return, math operation
Compatibility and Support
Introduced
LiveCode 1.0
OS
mac
windows
linux
ios
android
Platforms
desktop
server
mobile